package com.richard.room.app;

import androidx.room.TypeConverter;

import java.util.Date;
import java.util.List;

/**
 * @author: Richard
 * @createDate: 2023/4/17 11:08
 * @version: 1.0
 * @description: room类型转换
 */
public class DataConverter {

    @TypeConverter
    public static Date fromTimestamp(Long value) {
        return value == null ? null : new Date(value);
    }

    @TypeConverter
    public static Long dateToTimestamp(Date date) {
        return date == null ? null : date.getTime();
    }

    @TypeConverter
    public String objectToString(List<UserDTO> userDTO) {
//        return JsonConverter.toJson(userDTO);
        return "";
    }

    @TypeConverter
    public List<UserDTO> stringToObject(String json) {
//        return JsonConverter.toObjectList(json, UserDTO.class);
        return null;
    }
}
